<%@ Page Language="VB" MasterPageFile="~/userfiles/mastercms.master" Title="Sitemap" %>
<%@ import Namespace="System.Xml" %>

<%@ import Namespace="System.IO" %>
<script runat="server">
    'Version 05.06.2007 DH Pfad zu Userfiles/Sitemaps angepasst
    Dim result2 As String
    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim myUrl As String = Me.Context.Request.PhysicalApplicationPath & "/"
        result2 = GetSitemapXML(myUrl & "/userfiles/sitemaps/sitemap.xml")
    End Sub
    Function GetSitemapXML(ByVal fileName As String) As String
        Dim result As String = ""
 
        ' Reader instanzieren
        Dim reader As XmlReader = Nothing
 
        Try  
            reader = XmlReader.Create(fileName)
        Catch
            ' Alle Ausnahmen abfangen
            reader.Close()
        End Try
 
        If Not IsNothing(reader) Then
            ' Alle title-Knoten auslesen
            While reader.ReadToFollowing("siteMapNode")
                ' Inhalt auslesen und merken
                If reader.HasAttributes Then
                    result = result & "<p><a href=""" & reader.GetAttribute("url") & """>" & Server.HtmlEncode(reader.GetAttribute("linktext")) & "</a><br/>"
                    result = result & Server.HtmlEncode(reader.GetAttribute("metadescription")) & "</p>"
                    ' Move the reader back to the element node.
                    reader.MoveToElement()
                End If


            End While
 
            ' Aufräumen
            reader.Close()
        End If
 
        ' Ergebnis zurückgeben
        Return result
    End Function

</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <% =result2%>
</asp:Content>

